#include<bits/stdc++.h>
using namespace std;
int cnt = 0;
void count(int i) {
    while (i) {
        int mod = i % 10;
        if (mod == 2) {
            cnt ++;
            return;
        }
        i /= 10;
    }
}

int main() {
    for (int i = 1; i <= 2020; i++) {
        count(i);
    }
    cout << cnt << endl;
    return 0;
}

// 624